Skip to content

3708: Add new code generator from AVRO to PHP#36

Open
martin-augment wants to merge 3 commits intomainfrom
pr-3708-2026-03-30-19-30-13
Open

3708: Add new code generator from AVRO to PHP#36
martin-augment wants to merge 3 commits intomainfrom
pr-3708-2026-03-30-19-30-13

Conversation

@martin-augment
Copy link
Copy Markdown
Owner

3708: To review by AI

@github-actions github-actions bot added the Php label Mar 30, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 2026

Walkthrough

This pull request introduces a code generation feature for the Avro PHP library. It adds a new AvroCodeGenerator class that translates Avro schemas into generated PHP source files. The generator creates PHP classes for records (with typed properties, constructors, getters, and JSON serialization) and string-backed enums from Avro schema definitions. Supporting additions include a custom exception class, a new PHP parser dependency, expanded public APIs in existing schema classes through additional accessor methods and return type declarations, and a comprehensive test suite with 23 test cases covering various schema scenarios including nested records, enums, unions, arrays, maps, and default values.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pr-3708-2026-03-30-19-30-13

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new PHP code generator for Avro schemas, utilizing the nikic/php-parser library to generate PSR-compliant classes and enums. The implementation includes a main generator class, custom exception handling, and comprehensive unit tests. However, several critical issues were identified in the generator logic: a mismatch between filenames and class names that will break PSR-4 autoloading, a runtime error due to the use of a non-existent Node\ArrayItem class, and potential ParseError risks with indented heredocs. Additionally, the jsonSerialize implementation currently fails to correctly handle collections (arrays or maps) of enums, which will lead to invalid JSON output.


PHP;

$filename = $path.'/'.ucwords($name).'.php';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The filename is being generated using the Avro fullname ($name), but the class name inside the file is generated using the short name ($registeredSchema->name()). This mismatch will break PSR-4 autoloading. Additionally, ucwords on a fullname containing dots (e.g., com.example.User) will not produce a valid filename or directory structure as intended. You should use the short name for the filename to match the class name, especially since all classes are being placed in the same PHP namespace.

                $filename = $path.'/'.ucwords($registeredSchema->name()).'.php';

Comment on lines +213 to +216
$arrayItems[] = new Node\ArrayItem(
$this->buildJsonSerializeValue($field->type(), $field->name()),
new String_($field->name())
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The class Node\ArrayItem does not exist in php-parser. Based on your other usages of the Node\Expr namespace in this file, this should be Node\Expr\ArrayItem. This will cause a runtime error when generating code for records with fields.

            $arrayItems[] = new Node\Expr\ArrayItem(
                $this->buildJsonSerializeValue($field->type(), $field->name()),
                new String_($field->name())
            );

Comment on lines +79 to +86
$code = <<<PHP
<?php

declare(strict_types=1);

{$this->printer->prettyPrint([$node])}

PHP;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using indented flexible heredocs with empty lines can be fragile. In PHP, every line within the heredoc must have at least the same indentation as the closing identifier. If the 'empty' lines (81, 83, 85) do not contain the exact number of spaces as the closing PHP; tag, a ParseError will occur. It is safer to use a non-indented heredoc or ensure the empty lines are properly padded, though the former is much more maintainable.

Comment on lines +240 to +260
private function buildJsonSerializeValue(AvroSchema $fieldType, string $fieldName): Node\Expr
{
$propertyFetch = new Node\Expr\PropertyFetch(new Node\Expr\Variable('this'), $fieldName);

if ($fieldType instanceof AvroEnumSchema) {
return new Node\Expr\PropertyFetch($propertyFetch, 'value');
}

if ($fieldType instanceof AvroUnionSchema) {
$nonNullSchemas = array_values(array_filter(
$fieldType->schemas(),
static fn (AvroSchema $s): bool => !($s instanceof AvroPrimitiveSchema && AvroSchema::NULL_TYPE === $s->type())
));

if (1 === count($nonNullSchemas) && $nonNullSchemas[0] instanceof AvroEnumSchema) {
return new Node\Expr\NullsafePropertyFetch($propertyFetch, 'value');
}
}

return $propertyFetch;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The jsonSerialize logic correctly handles single Enum fields by accessing the ->value property, but it does not handle collections (arrays or maps) of Enums. Since the generated Enums are Backed Enums and do not implement JsonSerializable, json_encode will not automatically convert them to their string values when they are nested in arrays or maps. This will result in invalid Avro JSON output for schemas containing collections of enums.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
lang/php/test/Generator/AvroCodeGeneratorTest.php (1)

30-37: Consider renaming $transpiler to $generator for consistency.

The property name $transpiler doesn't match the class name AvroCodeGenerator. This minor inconsistency could be addressed for clarity.

Proposed fix
 class AvroCodeGeneratorTest extends TestCase
 {
-    private AvroCodeGenerator $transpiler;
+    private AvroCodeGenerator $generator;

     public function setUp(): void
     {
-        $this->transpiler = new AvroCodeGenerator();
+        $this->generator = new AvroCodeGenerator();
     }

Note: This would require updating all $this->transpiler references to $this->generator throughout the test file.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lang/php/test/Generator/AvroCodeGeneratorTest.php` around lines 30 - 37,
Rename the test property $transpiler to $generator in the AvroCodeGeneratorTest
class and update all usages to maintain consistency with AvroCodeGenerator;
specifically change the property declaration "private AvroCodeGenerator
$transpiler;" to use $generator, update the setUp() method where
$this->transpiler = new AvroCodeGenerator(); to assign to $this->generator, and
replace every $this->transpiler reference in the file with $this->generator
(ensure type hint remains AvroCodeGenerator).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@lang/php/lib/Generator/AvroCodeGenerator.php`:
- Around line 273-277: The enum generation uses strtoupper($value) to make
$caseName which can collide for symbols that differ only by case (e.g. "red" vs
"RED"); update the logic in AvroCodeGenerator (the loop building $caseName and
calling $enum->addStmt) to detect duplicate $caseName values before adding cases
and handle them deterministically—either throw a clear error listing the
conflicting symbols or disambiguate by appending a unique suffix/index or using
a safer transformation that preserves uniqueness (e.g., include original chars
or an incremental suffix); ensure the chosen approach prevents duplicate enum
cases and that the error/handling references the original $value strings so
generated code remains valid.
- Around line 88-89: The filename generation currently uses ucwords($name) where
$name is the fullname (e.g., "com.example.User"), which produces incorrect
filenames for namespaced schemas; update the code in AvroCodeGenerator.php to
use the schema's simple name (e.g., $registeredSchema->name()) when building
$filename so that $files[$filename] contains the correct file path (ucwords can
be removed or applied to the simple name if desired) and ensure the registry key
can remain the fullname in $name.

---

Nitpick comments:
In `@lang/php/test/Generator/AvroCodeGeneratorTest.php`:
- Around line 30-37: Rename the test property $transpiler to $generator in the
AvroCodeGeneratorTest class and update all usages to maintain consistency with
AvroCodeGenerator; specifically change the property declaration "private
AvroCodeGenerator $transpiler;" to use $generator, update the setUp() method
where $this->transpiler = new AvroCodeGenerator(); to assign to
$this->generator, and replace every $this->transpiler reference in the file with
$this->generator (ensure type hint remains AvroCodeGenerator).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c728f618-1f35-4b95-8dd0-2b4249e52692

📥 Commits

Reviewing files that changed from the base of the PR and between c59b5d6 and 5ce7149.

📒 Files selected for processing (7)
  • composer.json
  • lang/php/lib/Generator/AvroCodeGenerator.php
  • lang/php/lib/Generator/AvroCodeGeneratorException.php
  • lang/php/lib/Schema/AvroEnumSchema.php
  • lang/php/lib/Schema/AvroName.php
  • lang/php/lib/Schema/AvroNamedSchema.php
  • lang/php/test/Generator/AvroCodeGeneratorTest.php

Comment on lines +88 to +89
$filename = $path.'/'.ucwords($name).'.php';
$files[$filename] = $code;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

ucwords() may produce unexpected results for namespaced schema names.

ucwords($name) capitalizes the first letter of each word (space-delimited by default). For Avro fullnames like com.example.User, this produces Com.example.user.php instead of the expected User.php. The registry key is the fullname, but the file should use only the simple name.

Consider using $registeredSchema->name() (the simple name) instead of the fullname for the filename:

Proposed fix
-                $filename = $path.'/'.ucwords($name).'.php';
+                $filename = $path.'/'.ucfirst($registeredSchema->name()).'.php';
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lang/php/lib/Generator/AvroCodeGenerator.php` around lines 88 - 89, The
filename generation currently uses ucwords($name) where $name is the fullname
(e.g., "com.example.User"), which produces incorrect filenames for namespaced
schemas; update the code in AvroCodeGenerator.php to use the schema's simple
name (e.g., $registeredSchema->name()) when building $filename so that
$files[$filename] contains the correct file path (ucwords can be removed or
applied to the simple name if desired) and ensure the registry key can remain
the fullname in $name.

Comment on lines +273 to +277
foreach ($values as $value) {
$caseName = strtoupper($value);
$enum->addStmt(
$this->factory->enumCase($caseName)->setValue($value)
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Potential enum case name collision when symbols differ only by case.

strtoupper($value) will produce identical case names for symbols like ["red", "RED"] or ["Yes", "YES"], resulting in duplicate enum cases and a PHP parse error in the generated code.

Consider adding a check for collisions or preserving original casing:

Proposed fix - detect collisions
+    private function buildEnumCases(array $values): array
+    {
+        $caseNames = [];
+        $statements = [];
+        foreach ($values as $value) {
+            $caseName = strtoupper($value);
+            if (isset($caseNames[$caseName])) {
+                throw new AvroCodeGeneratorException(
+                    sprintf('Enum case collision: "%s" and "%s" both map to "%s"', $caseNames[$caseName], $value, $caseName)
+                );
+            }
+            $caseNames[$caseName] = $value;
+            $statements[] = $this->factory->enumCase($caseName)->setValue($value);
+        }
+        return $statements;
+    }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lang/php/lib/Generator/AvroCodeGenerator.php` around lines 273 - 277, The
enum generation uses strtoupper($value) to make $caseName which can collide for
symbols that differ only by case (e.g. "red" vs "RED"); update the logic in
AvroCodeGenerator (the loop building $caseName and calling $enum->addStmt) to
detect duplicate $caseName values before adding cases and handle them
deterministically—either throw a clear error listing the conflicting symbols or
disambiguate by appending a unique suffix/index or using a safer transformation
that preserves uniqueness (e.g., include original chars or an incremental
suffix); ensure the chosen approach prevents duplicate enum cases and that the
error/handling references the original $value strings so generated code remains
valid.

@augmentcode
Copy link
Copy Markdown

augmentcode bot commented Mar 30, 2026

🤖 Augment PR Summary

Summary: This PR introduces an Avro-to-PHP code generator for the PHP implementation.

Changes:

  • Adds Apache\Avro\Generator\AvroCodeGenerator (built on nikic/php-parser) that translates Avro record/enum schemas into PHP source strings
  • Generates final record classes implementing \JsonSerializable, plus PHP 8.1 backed enums for Avro enums
  • Recursively collects nested/unioned schemas into a registry so translate() can emit multiple files in one call
  • Adds AvroCodeGeneratorException for unsupported primitive types
  • Adds name() accessors on AvroName and AvroNamedSchema, and tightens return types in AvroEnumSchema
  • Adds a large PHPUnit test suite covering primitives, unions, defaults, arrays, maps, records, and enums
  • Updates composer.json to require nikic/php-parser

Technical Notes: The generator returns a filename => contents map; callers are expected to persist files under the provided path/namespace.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 5 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

private function avroPrimitiveTypeToPhp(AvroPrimitiveSchema $primitiveSchema): string
{
return match ($primitiveSchema->type()) {
AvroSchema::NULL_TYPE => 'null',
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lang/php/lib/Generator/AvroCodeGenerator.php:299: Mapping Avro null to the standalone PHP type null will generate code that does not compile on PHP 8.1 (standalone null types are only allowed starting in PHP 8.2), which conflicts with the package’s php: ^8.1 requirement. This also means the record_with_all_primitive_types expectation currently codifies output that can’t be executed on PHP 8.1.

Severity: high

Other Locations
  • lang/php/test/Generator/AvroCodeGeneratorTest.php:593
  • lang/php/test/Generator/AvroCodeGeneratorTest.php:601
  • lang/php/test/Generator/AvroCodeGeneratorTest.php:612

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.


PHP;

$filename = $path.'/'.ucwords($name).'.php';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lang/php/lib/Generator/AvroCodeGenerator.php:88: translate() uses the registry key ($name = schema fullname) to form the filename, while the generated class/enum name is based on the unqualified schema name(). For schemas with an Avro namespace, this can produce filenames containing dots / not matching the declared type name, which can break common autoloading expectations.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

}

if ($field->hasDefaultValue()) {
$property->setDefault($this->buildDefault($field->defaultValue()));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lang/php/lib/Generator/AvroCodeGenerator.php:154: Default values are injected without considering the field schema, so defaults for non-scalar typed fields (notably enums and records) will likely emit invalid PHP (e.g., a string default for a property typed as a generated enum). This can cause a fatal error when the generated class is loaded.

Severity: high

Other Locations
  • lang/php/lib/Generator/AvroCodeGenerator.php:166

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.


foreach ($avroRecord->fields() as $field) {
$phpType = $this->avroTypeToPhp($field->type(), $phpNamespace);
$getter = $this->factory->method($field->name())
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lang/php/lib/Generator/AvroCodeGenerator.php:194: Generating property/method/parameter names directly from Avro field names can produce invalid PHP in edge cases (e.g., field name colliding with reserved keywords or with generated methods like jsonSerialize / __construct). When that happens, the generated file will fail to parse or will redeclare methods.

Severity: medium

Other Locations
  • lang/php/lib/Generator/AvroCodeGenerator.php:144
  • lang/php/lib/Generator/AvroCodeGenerator.php:164
  • lang/php/lib/Generator/AvroCodeGenerator.php:218

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

$enum = $this->factory->enum($className)->setScalarType('string');

foreach ($values as $value) {
$caseName = strtoupper($value);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lang/php/lib/Generator/AvroCodeGenerator.php:274: Enum case names are derived via strtoupper($value), which can collapse distinct Avro symbols that differ only by case (e.g., foo vs FOO) into duplicate PHP case identifiers. That would make the generated enum invalid.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

@claude
Copy link
Copy Markdown

claude bot commented Mar 30, 2026

Code Review — PR #36: Add PHP Code Generator for Avro Schemas

Overall this is a solid, well-structured addition with good test coverage. A few issues worth addressing before merge.


Bugs

1. switch ($schema::class) vs instanceof in collectSchemas()

lang/php/lib/Generator/AvroCodeGenerator.php, collectSchemas():

switch ($schema::class) {
    case AvroRecordSchema::class:

$schema::class is an exact class name match and does not handle subclasses. The rest of the codebase (e.g. avroTypeToPhp) correctly uses match(true) with instanceof. Using instanceof here is safer and consistent:

// preferred
if ($schema instanceof AvroRecordSchema) { ... }

2. ucwords() should be ucfirst()

ucwords() capitalizes the first letter of every whitespace-separated word. Avro names can't contain spaces, so this happens to produce the same result as ucfirst() for any valid schema name — but it's semantically incorrect and will confuse readers. Replace with ucfirst() throughout buildRecord(), buildEnum(), and avroTypeToPhp().

3. Enum symbol collision after strtoupper()

$caseName = strtoupper($value);

If an enum has symbols Red and RED (both valid in Avro), both map to the same PHP case RED, generating invalid PHP. Add a deduplication check and throw AvroCodeGeneratorException on conflict.

4. Named type references fall through to 'mixed' in avroTypeToPhp()

When Avro resolves a schema reference by name (e.g. the second use of PostalAddress in record_with_record_reuse_by_name), the field->type() may return an AvroNamedSchema instance rather than a concrete AvroRecordSchema/AvroEnumSchema. The current match in avroTypeToPhp() has no AvroNamedSchema arm, so it falls to default => 'mixed'. Verify how the PHP Avro library resolves named references (it may already return the concrete type), and add an explicit arm if needed.


Design Concerns

5. Stateful generator / non-reentrant

$this->registry is reset at the start of each translate() call. If a caller reuses one AvroCodeGenerator instance across multiple schemas (natural for batch generation), each call clobbers the prior state. This is fine for sequential use, but consider either making $registry a local variable inside translate(), or documenting that the instance is single-use.

6. Triple field iteration in buildRecord()

Fields are iterated three separate times: once for properties, once for the constructor, once for getters. Combining into a single pass would be cleaner and slightly more efficient (though not a correctness issue).

7. No namespace-aware path generation

The Avro schema's own namespace (e.g. com.example) is ignored — all generated files are written flat to $path. For schemas that span multiple Avro namespaces this can cause name collisions in the registry (keys are fullname() but class names are derived from name() alone). At minimum, document this limitation.


Minor / Style

8. buildDefault() doesn't wrap scalars

private function buildDefault(mixed $value): mixed
{
    if (is_array($value)) {
        return $this->factory->val($value);
    }
    return $value;
}

PhpParser's setDefault() accepts raw PHP scalars, so this works today. But for consistency and to avoid surprises with future PhpParser versions, consider wrapping all values through $this->factory->val($value).

9. avroTypeToPhp is called three times per field

Each field's type is computed three times (property, constructor param, getter). Introduce a small helper or cache the result per field to avoid repetition.

10. AvroCodeGeneratorException is never tested

The exception is thrown by avroPrimitiveTypeToPhp() for unknown types, but no test exercises this path. Add a test that passes a mock/stub AvroPrimitiveSchema with an unrecognized type.


Schema file changes (AvroEnumSchema, AvroName, AvroNamedSchema)

Adding return type hints (array, bool) to existing methods is a welcome improvement. Adding name(): string accessors is clean. No concerns here.


Test Coverage

The 23 test cases are thorough and cover edge cases well (nullable enums, nested arrays of arrays, schema reuse by name, all primitive types). Good work on this front.


Summary

Severity Issue
Bug switch ($schema::class) won't handle subclasses
Bug Enum symbol collision after strtoupper()
Design Named type references may resolve to 'mixed'
Design Stateful $registry — document or refactor
Minor ucwords()ucfirst()
Minor Triple field iteration
Minor Untested exception path

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.


PHP;

$filename = $path.'/'.ucwords($name).'.php';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filename uses fullname instead of simple name

High Severity

The filename at line 88 is built from $name, which is the registry key — i.e., $schema->fullname(). For Avro schemas with a namespace (e.g., "namespace": "com.example"), fullname() returns "com.example.User", producing a filename like Com.example.User.php. Meanwhile, buildRecord and buildEnum derive the class name from $schema->name() (the simple name, "User"). This mismatch means the generated file won't match its class name, breaking autoloading and PSR-4 conventions for any namespaced Avro schema.

Additional Locations (1)
Fix in Cursor Fix in Web

$schema instanceof AvroArraySchema => 'list<'.$this->avroTypeToPhpDocInner($schema->items(), $phpNamespace).'>',
$schema instanceof AvroMapSchema => 'array<string, '.$this->avroTypeToPhpDocInner($schema->values(), $phpNamespace).'>',
$schema instanceof AvroRecordSchema, $schema instanceof AvroEnumSchema => '\\'.$phpNamespace.'\\'.ucwords($schema->name()),
$schema instanceof AvroUnionSchema => $this->unionToPhp($schema, $phpNamespace),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHPDoc loses generic types for unions in nested contexts

Low Severity

avroTypeToPhpDocInner delegates to unionToPhp for union schemas, which in turn calls avroTypeToPhp — mapping arrays/maps to the bare 'array' string. This discards generic type information in PHPDoc. For example, a field typed as array<["null", {"type":"array","items":"int"}]> would produce list<null|array> instead of the correct list<null|list<int>>. The union branch here needs to call avroTypeToPhpDocInner on each member instead.

Fix in Cursor Fix in Web

$enum = $this->factory->enum($className)->setScalarType('string');

foreach ($values as $value) {
$caseName = strtoupper($value);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enum case names can collide with PHP reserved words

Medium Severity

strtoupper($value) on valid Avro enum symbols like "null", "true", "false", or "class" produces "NULL", "TRUE", "FALSE", "CLASS" — all reserved identifiers in PHP 8.1+ that cannot be used as enum case names. The generated PHP code would fail to compile for any Avro enum containing these common symbols.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants